/*
 * Scene.cpp
 *
 *  Created on: 2010-09-17
 *      Author: michal
 */
#include "Scene.h"

Scene::Scene()
{
	_fieldOfViewRad = PI * 0.25f;
	_ambientColor = Color(0.1f, 0.1f, 0.1f, 1.0f);
	_defaultMaterial = CreateMaterial();
}

Scene::~Scene()
{
	ObjectIterator i;
	for(i=_objects.begin() ; i!=_objects.end() ; i++)
		delete (*i);

	LightIterator j;
	for (j = _lights.begin(); j != _lights.end(); j++)
		delete (*j);

	MaterialIterator m;
	for (m = _materials.begin(); m != _materials.end(); m++)
		delete (*m);
}

Sphere * Scene::CreateSphere()
{
	Sphere * s = new Sphere;
	_spheres.push_back(s);
	_objects.push_back(s);
	return s;
}

Plane * Scene::CreatePlane()
{
	Plane * p = new Plane;
	_planes.push_back(p);
	_objects.push_back(p);
	return p;
}

MetaballGroup * Scene::CreateMetaballGroup()
{
	MetaballGroup  * mg = new MetaballGroup;
	_metaballGroups.push_back(mg);
	_objects.push_back(mg);
	return mg;
}

Light * Scene::CreateLight()
{
	Light * light = new Light;
	_lights.push_back(light);
	return light;
}

Material * Scene::CreateMaterial()
{
	Material * material = new Material;
	_materials.push_back(material);
	return material;
}

